using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;
using MVC4WPF;

namespace $rootnamespace$
{
    /// <summary>
    /// Interaction logic for $safeitemname$.xaml
    /// </summary>
    public partial class $safeitemname$ : $BaseType$<$ViewContractName$>$ControllerContractName$$ControllerModelContractName$
    {
        #region Controller Configuration

        /// <summary>
        /// External controller initilizer that is called after the controller has been initilized. 
        /// This is generally used when data objects are loaded after initilization, or
        /// you want to reset the controller to a configured default.
        /// </summary>
        protected override void ConfigureController()
        {

        }

        #endregion
        
		//Enter properties for the view contract in the properties region
        #region Properties
        $PropertyTemplateContent$$if$ ($ControllerUsesModelContract$ == True)
        #region Property - ModelContract

		//Local variable for property ModelContract
		private $ModelContractName$ _modelContract;

		/// <summary>
		/// The model contract interface.
		/// </summary>
        /// <remarks>
        /// This property supports INotifyPropertyChanged and INotifyPropertyChanging
        /// </remarks>
		public $ModelContractName$ ModelContract
		{
			get
			{
				return _modelContract;
			}

			set
			{
				OnPropertyChanging("ModelContract");				

				_modelContract = value;
	            
				OnPropertyChanged("ModelContract");
			}
		}

        /// <summary>
        /// Helper method that will release the resource for the 'ModelContract' property.
        /// </summary>
        protected virtual void ReleasePropertyModelContract()
        {
            _modelContract.Dispose();
        }    

		#endregion Property - ModelContract
        $endif$
        #endregion Properties  
        
        //Enter events for the view contract in the events region
        #region Events
        $EventTemplateContent$
        #endregion

        //Enter methods for the view contract in the methods region
        #region Methods
        $MethodTemplateContent$        
        #endregion Methods
        
        //Enter class logic for release of resources for the view contract in release resource logic region
        #region Release Resources Logic
        
        /// <summary>
        /// Releases all resources from the implemented contract.
        /// </summary>
        private void ReleaseContractResources()
        {
            #region Release Properties
            $ReleasePropertyTemplateContent$$if$ ($ControllerUsesModelContract$ == True)
            ReleasePropertyModelContract();
            $endif$
            #endregion

            #region Release Events
            $ReleaseEventTemplateContent$
            #endregion
        }
        
        #endregion        
    }
}